#ifndef OPENCV_H
#define OPENCV_H

#include <QObject>
#include <opencv2/opencv.hpp>
#include <opencv2/video.hpp>
#include <QString>
#include <QImage>
#include <QList>

using namespace cv;

class opencv : public QObject
{

    Q_OBJECT
public:
    explicit opencv(QObject *parent = nullptr);
    ~opencv();

    void setVideoCapture(VideoCapture cap);
    VideoCapture getVideoCapture();
    bool openVideo(QString path);
    void setFrameNum(int frameNum);
    void setFrameRate(int frameRate);
    void setFrameWidth(int frameWidth);
    void setFrameHeight(int frameHeight);
    int getFrameNum();
    int getFrameRate();
    int getFrameWidth();
    int getFrameHeight();
    QImage getOneFrame(int posNum);
    QList<QImage> getAllFrame();
    QImage MatToQImage(const cv::Mat& mat);

    void test01();

signals:

private:
    VideoCapture m_cap;
    int m_frameWidth = 0;
    int m_frameHeight = 0;
    int m_frameNum = 0;
    int m_frameRate = 0;

};

#endif // OPENCV_H
